home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
Libraries
/
mymenv-notify 2.0
/
vmyAEvents.cc
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-15
|
1KB
|
58 lines
//************************************************************************
// Verify handling of mandatory AppleEvents
#include "mymenv.h"
#include "myAEvents.h"
void main(void)
{
Initialize_MAC();
class Open_appl : AppleEventOpenAppl
{
OSErr operator() (void) { alert("Got OpenAppl Event"); return noErr; }
};
Open_appl open_appl;
class Open_doc
{
public:
Open_doc(const int no_items) { alert("%d items to open",no_items); }
Boolean operator () (AliasHandle file_spec)
{ alert("document to open '%s'",get_full_path(file_spec));
return TRUE; }
};
AppleEventOpenDoc<Open_doc> open_doc;
QuitFlag quit_flag;
const long event_timeout = 20;
EventRecord theEvent;
notify("Entering the event loop... Press any key or send a Quit event to stop");
while( !quit_flag.quitting() )
{
if( !WaitNextEvent(everyEvent, &theEvent, event_timeout, nil) )
continue; // got null event, do nothing
switch( theEvent.what )
{
case kHighLevelEvent: // All High-level events we're going to receive
do_well( AEProcessAppleEvent(&theEvent) ); // are Apple events
continue;
case keyDown:
case autoKey:
break; // Any key quits
default:
continue;
}
break;
}
if( quit_flag.quitting() )
alert("Must've got quit event");
}